import xadmin
from .models import Course
from .models import Lesson
from .models import Video
from .models import CourseResource


class CourseAdmin(object):
    list_display = ['name', 'desc', 'detail', 'degree', 'learn_times', 'students', 'fav_nums', 'image', 'click_nums', 'create_time', 'deleted']
    search_fields = ['name', 'desc', 'detail', 'degree', 'learn_times', 'students', 'fav_nums', 'image', 'click_nums']
    list_filter = ['name', 'desc', 'detail', 'degree', 'learn_times', 'students', 'fav_nums', 'image', 'click_nums', 'create_time', 'deleted']


class LessonAdmin(object):
    list_display = ['courseId', 'name', 'createUser', 'create_time', 'deleted']
    search_fields = ['courseId', 'name', 'createUser']
    list_filter = ['courseId__name', 'name', 'createUser', 'create_time', 'deleted']


class VideoAdmin(object):
    list_display = ['lessonId', 'name', 'createUser', 'create_time', 'deleted']
    search_fields = ['lessonId', 'name', 'createUser']
    list_filter = ['lessonId', 'name', 'createUser', 'create_time', 'deleted']


class CourseResourceAdmin(object):
    list_display = ['courseId', 'name', 'download', 'createUser', 'create_time', 'deleted']
    search_fields = ['courseId', 'name', 'download', 'createUser']
    list_filter = ['courseId', 'name', 'download', 'createUser', 'create_time', 'deleted']


xadmin.site.register(Course, CourseAdmin)
xadmin.site.register(Lesson, LessonAdmin)
xadmin.site.register(Video, VideoAdmin)
xadmin.site.register(CourseResource, CourseResourceAdmin)
